package com.grass.p019lv.game;

import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.http.BaseRes;
import com.androidx.p013lv.base.http.HttpUtils;
import com.androidx.p013lv.base.http.UrlManager;
import com.androidx.p013lv.base.http.callback.HttpCallback;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.androidx.p013lv.base.utils.NetUtil;
import com.androidx.p013lv.base.utils.ToastUtils;
import com.grass.p019lv.databinding.ActivityGameTransactionInfoBinding;
import com.grass.p019lv.game.adapter.GameWithDrawInfoAdapter;
import com.grass.p019lv.game.bean.GameWithDrawDetailbean;
import com.gyf.immersionbar.ImmersionBar;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;

/* renamed from: com.grass.lv.game.GameWithdrawHistoryActivity */
public class GameWithdrawHistoryActivity extends BaseActivity<ActivityGameTransactionInfoBinding> implements OnRefreshLoadMoreListener {
    String HTTP_TAG = "GameWithdrawHistoryActivity";
    GameWithDrawInfoAdapter adapter;
    String name;
    int page = 1;

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return R.layout.activity_game_transaction_info;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        this.name = getIntent().getStringExtra(Key.TXT);
        ((ActivityGameTransactionInfoBinding) this.binding).tvTitle.setText(this.name);
        ((ActivityGameTransactionInfoBinding) this.binding).refresh.setOnRefreshListener(this);
        ((ActivityGameTransactionInfoBinding) this.binding).refresh.setOnLoadMoreListener(this);
        ((ActivityGameTransactionInfoBinding) this.binding).tvBack.setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.game.GameWithdrawHistoryActivity.View$OnClickListenerC30381 */

            public void onClick(View view) {
                GameWithdrawHistoryActivity.this.finish();
            }
        });
        ((ActivityGameTransactionInfoBinding) this.binding).recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
        this.adapter = new GameWithDrawInfoAdapter();
        ((ActivityGameTransactionInfoBinding) this.binding).recycler.setAdapter(this.adapter);
        ((ActivityGameTransactionInfoBinding) this.binding).statusLayout.setOnRetryListener(new View.OnClickListener() {
            /* class com.grass.p019lv.game.GameWithdrawHistoryActivity.View$OnClickListenerC30392 */

            public void onClick(View view) {
                GameWithdrawHistoryActivity.this.page = 1;
                GameWithdrawHistoryActivity.this.getInfo();
            }
        });
        getInfo();
    }

    /* access modifiers changed from: package-private */
    public void getInfo() {
        if (this.page == 1) {
            GameWithDrawInfoAdapter gameWithDrawInfoAdapter = this.adapter;
            if (!(gameWithDrawInfoAdapter == null || gameWithDrawInfoAdapter.getData() == null || this.adapter.getData().size() <= 0)) {
                this.adapter.clear();
            }
            if (!NetUtil.isNetworkAvailable()) {
                ((ActivityGameTransactionInfoBinding) this.binding).statusLayout.showNoNet();
                return;
            }
            ((ActivityGameTransactionInfoBinding) this.binding).statusLayout.showLoading();
        }
        HttpUtils.getInsatance().get(UrlManager.getInsatance().getWithDrawInfo(this.page), new HttpCallback<BaseRes<GameWithDrawDetailbean>>(this.HTTP_TAG) {
            /* class com.grass.p019lv.game.GameWithdrawHistoryActivity.C30403 */

            public void onLvSuccess(BaseRes<GameWithDrawDetailbean> baseRes) {
                if (GameWithdrawHistoryActivity.this.binding != null) {
                    ((ActivityGameTransactionInfoBinding) GameWithdrawHistoryActivity.this.binding).statusLayout.hideLoading();
                    ((ActivityGameTransactionInfoBinding) GameWithdrawHistoryActivity.this.binding).refresh.finishRefresh();
                    ((ActivityGameTransactionInfoBinding) GameWithdrawHistoryActivity.this.binding).refresh.finishLoadMore();
                    if (baseRes.getCode() == 200) {
                        if (baseRes.getData() == null || baseRes.getData().getData() == null || baseRes.getData().getData().size() <= 0) {
                            if (GameWithdrawHistoryActivity.this.page == 1) {
                                ((ActivityGameTransactionInfoBinding) GameWithdrawHistoryActivity.this.binding).statusLayout.showEmpty();
                            } else {
                                ((ActivityGameTransactionInfoBinding) GameWithdrawHistoryActivity.this.binding).refresh.finishLoadMoreWithNoMoreData();
                            }
                        } else if (GameWithdrawHistoryActivity.this.page == 1) {
                            GameWithdrawHistoryActivity.this.adapter.setData(baseRes.getData().getData());
                            ((ActivityGameTransactionInfoBinding) GameWithdrawHistoryActivity.this.binding).refresh.resetNoMoreData();
                        } else {
                            GameWithdrawHistoryActivity.this.adapter.setDatasInEnd(baseRes.getData().getData());
                        }
                    } else if (GameWithdrawHistoryActivity.this.page == 1) {
                        ((ActivityGameTransactionInfoBinding) GameWithdrawHistoryActivity.this.binding).statusLayout.showError();
                    } else {
                        ToastUtils.getInstance().showWeak(baseRes.getMsg());
                    }
                }
            }
        });
    }

    @Override // com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
    public void onLoadMore(RefreshLayout refreshLayout) {
        GameWithDrawInfoAdapter gameWithDrawInfoAdapter = this.adapter;
        if (gameWithDrawInfoAdapter == null || gameWithDrawInfoAdapter.getData() == null || this.adapter.getData().size() == 0) {
            ((ActivityGameTransactionInfoBinding) this.binding).refresh.finishLoadMore();
            return;
        }
        this.page++;
        getInfo();
    }

    @Override // com.scwang.smartrefresh.layout.listener.OnRefreshListener
    public void onRefresh(RefreshLayout refreshLayout) {
        this.page = 1;
        getInfo();
    }

    /* access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onDestroy() {
        super.onDestroy();
        HttpUtils.getInsatance().cancelTag(this.HTTP_TAG);
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivityGameTransactionInfoBinding) this.binding).toolbar).init();
    }
}
